package com.sline.servlet.demo1_servlet._01_base;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class _02_HttpRequest extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");

        String name = req.getParameter("username");
        System.out.println(name);
        String sex = req.getParameter("sex");
        System.out.println(sex);
        String[] hobbys = req.getParameterValues("hobby");
        for (String hobby: hobbys) {
            System.out.println(hobby);
        }
    }
}
